import { createRouter, createWebHistory } from "vue-router";

import IndexVue from "@/views/index/index.vue";
import ClazzVue from "@/views/clazz/index.vue";
import DeptVue from "@/views/dept/index.vue";
import EmpVue from "@/views/emp/index.vue";
import LogVue from "@/views/log/index.vue";
import LoginVue from "@/views/login/index.vue";
import LayoutVue from "@/views/layout/index.vue";
import StuReportVue from "@/views/report/stu/index.vue";
import EmpReportVue from "@/views/report/emp/index.vue";
import StuVue from "@/views/stu/index.vue";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/login",
      name: "login",
      component: LoginVue,
    },
    {
      path: "/",
      name: "layout",
      redirect: "/index", // 默认路由（重定向）
      component: LayoutVue,
      children: [
        { path: "index", name: "index", component: IndexVue },
        { path: "clazz", name: "clazz", component: ClazzVue },
        { path: "dept", name: "dept", component: DeptVue },
        { path: "emp", name: "emp", component: EmpVue },
        { path: "log", name: "log", component: LogVue },
        { path: "empReport", name: "empReport", component: EmpReportVue },
        { path: "stuReport", name: "stuReport", component: StuReportVue },
        { path: "stu", name: "stu", component: StuVue },
      ],
    },
  ],
});

export default router;
